/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
<template>
    <div class="config-ssh">
        <div class="config-ssh__alert">
            <i class="sf-comp-iconfont icon-comp-lamp-tip"></i>
            <div class="alert-text">为了您的隐私安全，登录后请及时通过sudo passwd jovyan命令修改登陆密码，防止信息泄露。
            </div>
        </div>
        <div class="config-ssh__warp">
            <div class="form-item">
                <sf-fieldlabel style="margin-right: 8px;" :label-width="60">SSH协议</sf-fieldlabel>
                <sf-switch v-model="showForm"/>
            </div>
            <div v-show="showForm" class="form-item">
                <sf-fieldlabel :label-width="60">IP</sf-fieldlabel>
                <sf-textfield v-model="data.ip" style="margin-right: 24px;" default-disabled class="textfield-item"
                              :default-width="240"/>
                <sf-fieldlabel :label-width="36">端口</sf-fieldlabel>
                <sf-textfield v-model="data.port" class="textfield-item" default-disabled :default-width="240"/>
            </div>
            <div v-show="showForm" class="form-item">
                <sf-fieldlabel :label-width="60">用户名</sf-fieldlabel>
                <sf-textfield v-model="user"
                              style="margin-right: 24px;"
                              class="textfield-item"
                              default-disabled
                              :default-width="240">
                </sf-textfield>
                <sf-fieldlabel :label-width="36">密码</sf-fieldlabel>
                <sf-textfield v-model="data.key" class="textfield-item" default-disabled :default-width="240"/>
            </div>
        </div>
    </div>
</template>

<script>
import {downloadStringFile} from "src/util/blob_download";

export default {
    data() {
        return {
            showForm: true,
            user: 'jovyan',
            data: {
                ip: '',
                port: '',
                key: ''
            }
        }
    },
    methods: {
        copySuccess() {
            this.$ok('复制成功')
        },
        download() {
            downloadStringFile(this.data.key, 'id_rsa')
        }
    }
}
</script>

<style lang="less" scoped>
.config-ssh {
    &__alert {
        width: 600px;
        height: 34px;
        margin: 0 20px;
        background-color: #fdf3e4;
        display: flex;
        color: #EE8800;
        i {
            margin-top: 10px;
            margin-left: 7px;
            margin-right: 7px;
        }
        
        .alert-text {
            width: 554px;
            height: 22px;
            font-size: 12px;
            line-height: 22px;
            margin-top: 6px;
        }
    }
    
    &__warp {
        width: 600px;
        margin: 18px 20px;
        
        .form-item {
            display: flex;
            align-items: center;
            
            .sfv-fieldlabel {
                height: 20px;
                line-height: 20px;
                padding-left: 0;
            }
            
            .sfv-btn {
                width: 92px;
                font-size: 12px;
                line-height: 16px;
                text-align: center;
                color: #FFFFFF;
                padding: 0 10px;
                
                /deep/ .sfv-btn-text {
                    display: inline-block;
                    width: 72px;
                }
            }
            
            & + .form-item {
                margin-top: 16px;
            }
        }
    }
}
</style>
